<?php

class Mageex_Robot_Block_Adminhtml_Robot_Edit_Tab_Ebay extends Mage_Adminhtml_Block_Widget_Form
{
	  protected function _prepareForm()
	  {
			if ($head = $this->getLayout()->getBlock('head')) {
				$head->setCanLoadCalendarJs(true);
			}
		  $form = new Varien_Data_Form();
		  $this->setForm($form);
		  $fieldset = $form->addFieldset('robot_form', array('legend'=>Mage::helper('robot')->__('Main Settings')));
		 
		  $fieldset->addField('name', 'text', array(
			  'label'     => Mage::helper('robot')->__('Campaign Name'),
			  'class'     => 'required-entry',
			  'required'  => true,
			  'name'      => 'name',
		  ));
			$afterElementHtml = '<p class="note">Enter one keyword or phrase per line. For each post one of the keywords will be randomly selected.<br/><br/>You can enclose keywords in double quotes to enable exact search for them.<br/><br/><b>Example</b><br/>Banana<br/>"Mageex Extensions"<br/>Free Apple Ipods</p>';
			$fieldset->addField('keyword', 'textarea', array(
			  'label'     => Mage::helper('robot')->__('Keyword'),
			  'class'     => 'required-entry',
			  'required'  => true,
			  'name'      => 'keyword',
			  'after_element_html' => $afterElementHtml,
		  ));
		  $fieldset->addField('category', 'select', array(
			  'label'     => Mage::helper('robot')->__('Category'),
			  'name'      => 'category',
			  'values'    => Mage::getModel('robot/system_config_ebay_department')->toOptionArray(),
		  ));
		  $fieldset->addField('create_category', 'select', array(
          'label'     => Mage::helper('robot')->__('Create categories if not existing'),
          'name'      => 'create_category',
          'values'    => array(
              array(
                  'value'     => 1,
                  'label'     => Mage::helper('robot')->__('Yes'),
              ),

              array(
                  'value'     => 2,
                  'label'     => Mage::helper('robot')->__('No'),
              ),
          ),
      ));
	  $fieldset->addField('status', 'select', array(
			  'label'     => Mage::helper('robot')->__('Status'),
			  'name'      => 'status',
			  'values'    => array(
				  array(
					  'value'     => 1,
					  'label'     => Mage::helper('robot')->__('Enable'),
				  ),

				  array(
					  'value'     => 2,
					  'label'     => Mage::helper('robot')->__('Disable'),
				  ),
			  ),
		  ));
		  if ( Mage::getSingleton('adminhtml/session')->getRobotData() )
		  {
			  $form->setValues(Mage::getSingleton('adminhtml/session')->getRobotData());
			  Mage::getSingleton('adminhtml/session')->setRobotData(null);
		  } elseif ( Mage::registry('robot_data') ) {
			  $form->setValues(Mage::registry('robot_data')->getData());
		  }
		  return parent::_prepareForm();
	  }
}